from core.constant import *
from enum import Enum
from datetime import timedelta


class Framework(Enum):
    default_module = Module.Fighting  # 默认模型编号
    model_prefix = "model"  # 模型命名前缀
    code_name_info_csv = "stock_pool.csv"
    not_factor_ls = ["open", "high", "low", "close", "volume", "turnover"]
    show_canvas_module = [Module.Backtesting, Module.Fighting]


class FileManager(Enum):
    f = '-'  # 文件名参数连接符号


class View(Enum):
    main_win_size = [1400, 700]
    dynamic_module_size = [400, 400]
    label_width = 60
    widget_width = 340
    font = ("Microsoft YaHei UI", 9)
    running_size = [500, 400]
    operate_size = [400, 300]
    file_info_size = [500, 700]
    file_action_size = [500, 300]


class FactorAnalysis(Enum):
    stock_pool_csv = "stock_pool.csv"
    temp_am_size = 30


class Fighting(Enum):
    lifespan = timedelta(days=1)
    slippage = 0.01  # 用于生成市价单成交价的偏离价格
    default_account_id = "DDQ001"
    price_digit = 0.01
    live_period = timedelta(seconds=3)
    waiting_max_time = timedelta(seconds=120)


class KChart(Enum):
    draw_win_ls = [0, 2]
    timer_interval = 100
    default_config = [
        {
            'win_index': 0,
            'color_ls': ['red', 'green'],  # ['lightcoral', 'lightgreen']
            'color': '',
            'factor': '',
            'ele_type': 'bar'
        },
        {
            'win_index': 1,
            'color_ls': ['lightcoral', 'lightgreen'],
            'color': '',
            'factor': '',
            'ele_type': 'volume'
        }
    ]
    main_view_index = 0
    super_view_size = [1300, 700]
    console_view_width = 280
    title = "不掷硬币量化社群（V：YHDBank） K线图"
    font = ("Microsoft YaHei UI", 10)
    layout = "default"
    bg_color = "white"
    factor_order_color_ls = ["blue", "tomato", "tan", "coral", "maroon", "gold", "peru", "purple"]
    k_color_ls = ["red", "green"]
    tank_color_ls = ["red", "green"]
    x_axis_interval = 100
    y_axis_interval = 30
    x_axis_width = 30
    y_axis_width = 70
    show_y_label = True
    k_cont_width = 7
    index = -1
    k_cont_width_range = [3, 20]
    ele_weight = [3, 1, 1]
    not_factor_ls = Framework.not_factor_ls.value
    ori_data_len = 10000  # 默认传入K线图模块的最大数量，仅约束ui界面显示的起止时间。
    monitor_period = timedelta(seconds=3)
    point_factor = [SigType.Buy.value, SigType.Sell.value, SigType.Mess.value]
    tank_factor = []


class EMail(Enum):
    smtp_server = "smtp.163.com"
    smtp_port = 465
    send_user = ""
    password = ""
    receive_user = "不掷硬币社群@success.com"


class DataBridge(Enum):
    # symbol_name_def = ["600036.SH", "600519.SH"]
    symbol_name_def = ["stock_pool.csv,银行"]
    future_name_def = "fu2405"
    k_interval_ls = ["1m", "5m", "10m"]
    software_path = r"D:\国信iQuant策略交易平台"
    own_data_name = "data_bridge_flow"
    monitor_period = timedelta(seconds=3)


class AdditionModule(Enum):
    visualization_x_px = 1200
    k_px = 12
    axis_x_px = 50
    axis_x_interval = 150  # 100,150
    axis_y_px = 180  # 120,180
    axis_y_interval = 45  # 30,45
    ori_value = 100
    time_interval = 100
    sample_multiple = 1.1
    backtrack_time = 3
    order_num = 50
    color_ls = ["red", "gray", "blue", "magenta", "orange", "green", "maroon", "turquoise", "lightgreen", "purple", "pink", "violet", "yellow", "yellowgreen", "navy", "olive", "skyblue"]
    except_ls = ["指数", "金属新材料"]
    font = ("Microsoft YaHei UI", 15)
    index_sector = "指数"
    index_code = "000300.SH"


